
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module tests.cgi-bin.fgcp_relay</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="tests.html"><font color="#ffffff">tests</font></a>.<a href="tests.cgi-bin.html"><font color="#ffffff">cgi-bin</font></a>.fgcp_relay</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="http://code.google.com/p/fgcp-client-api/source/browse/cgi-bin/fgcp_relay.py">fgcp_relay.py</a></font></td></tr></table>
    <p><tt>This&nbsp;is&nbsp;a&nbsp;really&nbsp;basic&nbsp;CGI&nbsp;script&nbsp;that&nbsp;allows&nbsp;you&nbsp;to&nbsp;test&nbsp;the&nbsp;relay&nbsp;feature<br>
via&nbsp;a&nbsp;CGI&nbsp;webserver,&nbsp;e.g.&nbsp;by&nbsp;specifying&nbsp;the&nbsp;following&nbsp;region&nbsp;in&nbsp;your&nbsp;scripts:<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;region='relay=<a href="http://localhost:8000/cgi-bin/fgcp_relay.py">http://localhost:8000/cgi-bin/fgcp_relay.py</a>'<br>
&nbsp;<br>
In&nbsp;order&nbsp;to&nbsp;use&nbsp;this&nbsp;CGI&nbsp;script&nbsp;for&nbsp;relay&nbsp;testing,&nbsp;you&nbsp;need&nbsp;to&nbsp;adapt&nbsp;the&nbsp;lines<br>
&nbsp;&nbsp;&nbsp;&nbsp;pem_file&nbsp;=&nbsp;'../client.pem'<br>
&nbsp;&nbsp;&nbsp;&nbsp;region&nbsp;=&nbsp;'de'<br>
at&nbsp;the&nbsp;bottom&nbsp;of&nbsp;this&nbsp;script,&nbsp;and&nbsp;specify&nbsp;your&nbsp;own&nbsp;certificate&nbsp;and<br>
region&nbsp;there</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="cgi.html">cgi</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="tests.cgi-bin.fgcp_relay.html#FGCPRelayCGIScript">FGCPRelayCGIScript</a>
</font></dt></dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="FGCPRelayCGIScript">class <strong>FGCPRelayCGIScript</strong></a></font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="FGCPRelayCGIScript-__init__"><strong>__init__</strong></a>(self, key_file, region, environ<font color="#909090">={'FSCDRIVE': 'S:', 'TMP': 'C:\\TEMP', 'COMPUTERN...s\\Public', 'USERPROFILE': 'C:\\Users\\BRUMDall'}</font>, fpin<font color="#909090">=&lt;open file '&lt;stdin&gt;', mode 'r' at 0x0158D020&gt;</font>, fpout<font color="#909090">=&lt;open file '&lt;stdout&gt;', mode 'w' at 0x0158D068&gt;</font>, fperr<font color="#909090">=&lt;open file '&lt;stderr&gt;', mode 'w' at 0x0158D0B0&gt;</font>)</dt><dd><tt>Initialize&nbsp;variables,&nbsp;environment&nbsp;and&nbsp;filepointers&nbsp;for&nbsp;CGI&nbsp;script</tt></dd></dl>

<dl><dt><a name="FGCPRelayCGIScript-get_body"><strong>get_body</strong></a>(self, fpin<font color="#909090">=&lt;open file '&lt;stdin&gt;', mode 'r' at 0x0158D020&gt;</font>)</dt><dd><tt>Get&nbsp;request&nbsp;body</tt></dd></dl>

<dl><dt><a name="FGCPRelayCGIScript-get_header"><strong>get_header</strong></a>(self, name, default<font color="#909090">=None</font>)</dt><dd><tt>Get&nbsp;a&nbsp;particular&nbsp;header&nbsp;or&nbsp;return&nbsp;default</tt></dd></dl>

<dl><dt><a name="FGCPRelayCGIScript-get_headers"><strong>get_headers</strong></a>(self, environ<font color="#909090">={'FSCDRIVE': 'S:', 'TMP': 'C:\\TEMP', 'COMPUTERN...s\\Public', 'USERPROFILE': 'C:\\Users\\BRUMDall'}</font>)</dt><dd><tt>Get&nbsp;request&nbsp;headers</tt></dd></dl>

<dl><dt><a name="FGCPRelayCGIScript-get_host"><strong>get_host</strong></a>(self, region)</dt><dd><tt>Get&nbsp;host&nbsp;for&nbsp;this&nbsp;region</tt></dd></dl>

<dl><dt><a name="FGCPRelayCGIScript-raise_error"><strong>raise_error</strong></a>(self, text<font color="#909090">='Unknown'</font>)</dt><dd><tt>Write&nbsp;error&nbsp;message&nbsp;with&nbsp;traceback&nbsp;and&nbsp;exit&nbsp;CGI&nbsp;script</tt></dd></dl>

<dl><dt><a name="FGCPRelayCGIScript-run"><strong>run</strong></a>(self)</dt><dd><tt>Relay&nbsp;the&nbsp;request&nbsp;to&nbsp;the&nbsp;API&nbsp;server&nbsp;and&nbsp;send&nbsp;back&nbsp;the&nbsp;response</tt></dd></dl>

<dl><dt><a name="FGCPRelayCGIScript-set_environ"><strong>set_environ</strong></a>(self, environ<font color="#909090">={'FSCDRIVE': 'S:', 'TMP': 'C:\\TEMP', 'COMPUTERN...s\\Public', 'USERPROFILE': 'C:\\Users\\BRUMDall'}</font>)</dt><dd><tt>Set&nbsp;environment&nbsp;variables</tt></dd></dl>

<dl><dt><a name="FGCPRelayCGIScript-set_fp"><strong>set_fp</strong></a>(self, fpin<font color="#909090">=&lt;open file '&lt;stdin&gt;', mode 'r' at 0x0158D020&gt;</font>, fpout<font color="#909090">=&lt;open file '&lt;stdout&gt;', mode 'w' at 0x0158D068&gt;</font>, fperr<font color="#909090">=&lt;open file '&lt;stderr&gt;', mode 'w' at 0x0158D0B0&gt;</font>)</dt><dd><tt>Set&nbsp;filepointers&nbsp;for&nbsp;input&nbsp;and&nbsp;output</tt></dd></dl>

<dl><dt><a name="FGCPRelayCGIScript-write_output"><strong>write_output</strong></a>(self, content_type<font color="#909090">='text/plain'</font>, data<font color="#909090">='Unknown'</font>, fpout<font color="#909090">=&lt;open file '&lt;stdout&gt;', mode 'w' at 0x0158D068&gt;</font>)</dt><dd><tt>Write&nbsp;Content-type&nbsp;and&nbsp;data</tt></dd></dl>

<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>body</strong> = None</dl>

<dl><dt><strong>environ</strong> = None</dl>

<dl><dt><strong>fpin</strong> = None</dl>

<dl><dt><strong>fpout</strong> = None</dl>

<dl><dt><strong>headers</strong> = None</dl>

<dl><dt><strong>host</strong> = None</dl>

<dl><dt><strong>key_file</strong> = None</dl>

<dl><dt><strong>method</strong> = None</dl>

<dl><dt><strong>region</strong> = None</dl>

<dl><dt><strong>uri</strong> = '/ovissapi/endpoint'</dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>FGCP_REGIONS</strong> = {'au': 'api.globalcloud.fujitsu.com.au', 'de': 'api.globalcloud.de.fujitsu.com', 'jp': 'api.oviss.jp.fujitsu.com', 'sg': 'api.globalcloud.sg.fujitsu.com', 'uk': 'api.globalcloud.uk.fujitsu.com', 'us': 'api.globalcloud.us.fujitsu.com'}</td></tr></table>
</body></html>